package cn.tj212.xiaoyin.common.web;

/**
 * Session中的SessionAttribute对象加入超时属性
 * 时间从创建对象开始
 */
public class SessionTimeObj {
    private Object value;//值对象
    private Long overTime;//超时时间
    private Long currentTime;//加入value时的当前时间

    public SessionTimeObj(Object value, Long overTime) {
        this.value = value;
        this.overTime = overTime;
        currentTime=System.currentTimeMillis();
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public Long getOverTime() {
        return overTime;
    }

    public void setOverTime(Long overTime) {
        this.overTime = overTime;
    }

    public boolean isOverTime(){
        return System.currentTimeMillis()-currentTime>overTime;
    }
}
